import { http, ResponseData } from '../http'
import { AxiosPromise } from 'axios'

// 获取列表
export const getList = (): AxiosPromise<ResponseData> => {
  return http.request({
    method: 'GET',
    url: '/v1/role',
  })
}

// 删除
export const deleteById = (id: any): AxiosPromise<ResponseData> => {
  return http.request({
    method: 'DELETE',
    url: `/v1/role/${id}`,
  })
}

// 添加
export const add = (data: any): AxiosPromise<ResponseData> => {
  return http.request({
    method: 'POST',
    url: '/v1/role',
    data,
  })
}

// 编辑
export const edit = (data: any): AxiosPromise<ResponseData> => {
  return http.request({
    method: 'PUT',
    url: '/v1/role',
    data,
  })
}

// 获取详情
export const getDetail = (id: any): AxiosPromise<ResponseData> => {
  return http.request({
    method: 'GET',
    url: `/v1/role/${id}`,
  })
}